package edu.xidian.sselab.cloudcourse.domain;

import lombok.Data;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;

import java.util.List;

@Data
public class test2_entity {
    String price_section; //价格区间
    String salenumber; //销售数量

    public test2_entity map(Result result) { //将查询hbase的查询结果映射为test2_entity类
        setPrice_section(Bytes.toString(result.getRow()));
        List<Cell> cellList = result.listCells();
        Cell cell = cellList.get(0);
        String value = Bytes.toString(CellUtil.cloneValue(cell));
        setSalenumber(value);
        return this;
    }
}
